package structure.composite.components;

import structure.composite.abstracts.OrganizationComponent;

import java.util.ArrayList;
import java.util.List;

public class University extends OrganizationComponent {
    public University(String description) {
        super(description);
    }

    List<OrganizationComponent> components = new ArrayList<>();

    @Override
    public void add(OrganizationComponent component) {
        components.add(component);
    }

    @Override
    public void remove(OrganizationComponent component) {
        components.remove(component);
    }

    @Override
    public String getDescription() {
        return super.getDescription();
    }

    @Override
    public void print() {
        System.out.println("    " + getDescription());
        components.forEach(component -> {
            System.out.print("  ");
            component.print();
        });
    }
}
